_ = require 'underscore'
MongooseClient = require '../../../models/mongoose_client'
AppConfig = require '../config'
MongooseConnection = MongooseClient.getMongooseConnection AppConfig.mongo

schemaInfoList =
  Article : 'article'
  Reflection : 'reflection'
  RecommendArticle : 'recommend_article'
  User : 'user'
  Message : 'message'

initModel = (schemaInfoList) ->
  _.each schemaInfoList, (value, key) ->
    module.exports[key] = MongooseConnection.model key, require "./schema/#{value}"

initModel schemaInfoList

# Article = conn.model 'Article', require './schema/article'
# Reflection = conn.model 'Reflection', require './schema/reflection'
# RecommendArticle = conn.model 'RecommendArticle', require './schema/recommend_article'
# User = conn.model 'User', require './schema/user'
# Message = conn.model 'Message', require './schema/message'